<template>
  <view>
    <view class="personal_info">
      <view class="photo_wrap">
        <image :src="ownersPic" class="photo"></image>
      </view>
      <view class="nickname" v-model="owners">
        {{ownersName}}
      </view>
    </view>
    <view class="wode_item_wrap">
      <view class="wode_item" >
        我的收藏
        <span class="arrow_wrap"></span>
      </view>
      <view class="wode_item" >
        我的小区
        <span class="arrow_wrap"></span>
      </view>
      <view class="wode_item" >
        我的地址
        <span class="arrow_wrap"></span>
      </view>
      <view class="wode_item" >
        联系客服
        <span class="arrow_wrap"></span>
      </view>
      <view class="wode_item" >
        关于我们
        <span class="arrow_wrap"></span>
      </view>
    </view>
    <view class="wode_out">
      <button @click="handleLogout">注销</button>

    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      ownersName:"",
      ownersPic:"",
      ownerText:[]
    }
  },
  methods: {
    zyOwnerName(){
      var ownersReal = [];
      var ovnersPicturn = [];
      this.username = uni.getStorageSync("username",this.username);
      uni.request({
        url:'ownerName?ownerRealName='+this.username,
        data:{},
        method:"GET",
        success: (res) => {
          this.owners = res.data.data;
          console.log(this.owners)
          for(var i=0;i<res.data.data.length;i++){
            ownersReal.push(res.data.data[i].ownerRealName);
            this.ownersName = res.data.data[i].ownerRealName;
            ovnersPicturn.push(res.data.data[i].ownerPortrait);
            this.ownersPic = res.data.data[i].ownerPortrait;

          }
          this.ownerText2 = ownersReal;
          console.log(this.ownerText2);
          this.ownerText3 = ovnersPicturn;
          console.log(this.ownerText3)
          // for(var i=0;i<res.data.data.length;i++){
          // 	ownerText.push(res.data.data[i].ownerRealName);
          // }
          // this.owners = ownerText;
          // console.log(owners);
          // for(var i = 0;i<res.data.data.length;i++){
          // 	ownerText.push(res.data.data[i].ownerRealName)
          // },
          // this.ownerName = ownerText;

        }
      })

    },
    handleLogout() {
      // 执行注销操作，比如清除缓存数据
      uni.removeStorageSync('userInfo');

      // 跳转到登录页
      uni.reLaunch({
        url: '/pages/login/login'
      });
    }

  },
  mounted() {
    this.zyOwnerName();

  }
}
</script>

<style>
.personal_info {
  padding: 20px 0;
  background-color: #FFF;
}
.photo_wrap {
  text-align: center;
}
.photo {
  width: 90px;
  height: 90px;
  border-radius: 90px;
}
.nickname {
  margin-top: 15px;
  text-align: center;
  color: #696969;
}
.wode_item_wrap {
  background-color: #FFF;
  font-size: 14px;
  margin-top: 10px;
  border-top: 1px solid #E5E5E5;
}
.wode_item {
  height: 45px;
  border-bottom: 1px solid #E5E5E5;
  padding: 0 10px;
  line-height: 45px;
  position: relative;
}
.arrow_wrap {
  position: absolute;
  width: 50px;
  height: 45px;
  right: 0;
  top: 0;

  background-repeat: no-repeat;
  background-size: 16px;
  background-position: 17px 14px;
}
.wode_out {
  height: 45px;
  line-height: 45px;
  text-align: center;
  background-color: #FFF;
  margin-top: 10px;
  border-bottom: 1px solid #E5E5E5;
  border-top: 1px solid #E5E5E5;
}

</style>
